<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/util.tld" prefix="myutil" %>
<!DOCTYPE HTML>
<html>
  <head>
    <title>商品管理</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<link href = "/ecp/resources/css/default/base.css" rel = "stylesheet" type = "text/css"/>
	<link href = "/ecp/resources/css/uploadify.css" rel = "stylesheet" type = "text/css"/>
	
    <script type="text/javascript" src="/ecp/resources/js/jquery-1.8.1.js"></script>
    <script type="text/javascript" src="/ecp/resources/js/tydic.js"></script>
    <script type="text/javascript" src="/ecp/resources/js/public.js"></script>
    <script type="text/javascript" src="/ecp/resources/js/jquery.uploadify.min.js"></script>
    <script type = "text/javascript">
    var tab  ={};
         jQuery(function($) {
			dicPath = '/ecp/resources/css/default/images/';
			
			
						
   // 设置上传
    $("#file_upload").uploadify({
        'auto'     : true,
        'multi'    : true,
        'swf'      : '/ecp/resources/flash/uploadify.swf',
        'uploader' : '/ecp/backstage/test/upload.do',
        'method'   : 'post',
        'formData' : {'someKey' : 'someValue','someOtherKey' : 1},
        'buttonText' : '选择图片',
        'fileTypeDesc' : 'image Files',
        'fileTypeExts' : '*.gif; *.png; *.jpg',
        'fileSizeLimit' : '10MB',
        'height' : 20,
        'width' : 60,
        'removeTimeout' : 1,
        'onUploadSuccess' : function(file, data, response) {
            $("#imgsTd").prepend("<div><a style='background-color:red'  ondblclick='javascript:$(this).parent().remove();'>"+file.name+"</a><input name='imgs' type='hidden'   value='"+file.name+"'></div>"); 
        },
        'onCancel' : function(file) {
             
        } 
        });
		});
		
		 function save(){
		    editor.sync();
		    submitForm("addgoodform","/ecp/backstage/goods/addGoods.do");
		 }
		 
		function uploadImg(){
		   // win =  showWindow('/ecp/backstage/goods/toUpdateGoodsImg.do?goodsId=2','商品图片管理',600,250);
		   tab.add({title:'newTab', url : '/ecp/backstage/goods/toUpdateGoodsImg.do?goodsId=2', height : 500});//动态添加页签 
		}
		
		
	</script>
	 
	 
	 <script charset="utf-8" src="/ecp/editor/kindeditor-min.js"></script>
    <script charset="utf-8" src="/ecp/editor/lang/zh_CN.js"></script>
	<script>
	        KindEditor.ready(function(K) {
	            window.editor =  K.create('#editor_id', {
                uploadJson : '/ecp/backstage/goods/html/upload.do',
                fileManagerJson : '/ecp/backstage/goods/html/fileManager.do',
                allowFileManager : true
             });
	                //   /ecp/editor/jsp/upload_json.jsp
	                
	          // 按钮
	          var uploadbutton = K.uploadbutton({
					button : K('#uploadButton')[0],
					fieldName : 'imgFile',
					url : '/ecp/backstage/goods/html/upload.do?dir=flash',
					afterUpload : function(data) {
						if (data.error === 0) {
							var url = K.formatUrl(data.url, 'absolute');
							K('#url').val(url);
						} else {
							alert(data.message);
						}
					},
					afterError : function(str) {
						alert('自定义错误信息: ' + str);
					}
				});
				
				uploadbutton.fileBox.change(function(e) {
					uploadbutton.submit();
				});
	               
	        });
	</script>
  </head>
  
  <body>
   
      <myutil:munuPaht menueId='${param.menuId}' optName="新增11商品"/>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td class="ico21">
					&nbsp;
				</td>
				<td class="tb">
					新增商品
				</td>
				<td class="ico4">
					&nbsp;
				</td>
			</tr>
		</table>
		<form id="addgoodform" >
        <table width="100%" border="0" cellpadding="0" cellspacing="0"
				class="formTable ">
				<tbody>
				    <tr>
						<th width="15%">
							商品名称：
						</th>
						<td width="35%">
							 <input type="text" class="input120" name="name" value="${name}"  />
						</td>
						<th width="15%">
						         商品标题：
						</th>
						<td width="35%">
						   <input type="text" class="input120" name="title"   />
						</td>
					</tr>
					<tr>
						<th width="15%">
							商品价格：
						</th>
						<td width="35%">
							 <input type="text" class="input120" name="price" value="${price}"  />
						</td>
						<th width="15%">
						         商品市场价格：
						</th>
						<td width="35%">
						   <input type="text" class="input120" name="mPrice"   />
						</td>
					</tr>
					<tr>
						<th width="15%">
							会员价格：
						</th>
						<td width="35%">
							 <input type="text" class="input120" name="vipPrice" value="${vipPrice}"  />
						</td>
						<th width="15%">
						</th>
						<td width="35%">
						  &nbsp;
						</td>
					</tr>
					<tr>
						<th width="15%">
							商品LOGO：
						</th>
						<td width="35%" id="imgsTd">
						  <input class="ke-input-text" type="text" id="url" value="" readonly="readonly" /> 
						  <input type="button" id="uploadButton" value="Upload" />
						</td>
						<th width="15%">
							商品类别：
						</th>
						<td width="35%">
							  <select name = "typeId" size = "1" class = "input120">
                                <option value="-1">--请选择--</option>
                                <option value="-1">顶级类别</option>
                                <c:forEach items="${list}" var="goodtype">
                                   <option value="${goodtype['id']}">${goodtype['name']}</option>
                                </c:forEach>
                            </select>
						</td>
					</tr>
					<tr>
						<th width="15%">
							商品描述：
						</th>
						<td width="85%" colspan="3">
							<textarea id="editor_id" rows="25" cols="120" name="desc"></textarea>
						</td>
					</tr>
				</tbody>
			</table>
			</form>
			<table width="100%" border="0" cellspacing="0" cellpadding="0"
				class="mT5">
				<tr>
					<td height="30" align="center">
						<input name="btnSave" id="btnSave" type="button" class="btn1" value="提交"
							onClick="save();">
						<input type="button" value="返回" class="btn1" onclick="history.go(-1);"/>
					</td>
				</tr>
			</table>
     
  </body>
</html>